Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to target_link_libraries in test_tracetools. #83

Merged
merged 3 commits into from
Nov 30, 2023

Conversation

clalancette
Copy link
Contributor

@clalancette clalancette commented Nov 26, 2023

While we are in here, mark all dependencies as test_depend (since this is a test-only package).

@clalancette
Copy link
Contributor Author

clalancette commented Nov 26, 2023

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@clalancette clalancette force-pushed the clalancette/target-link-libraries branch 2 times, most recently from 2056cf0 to 2fa65c1 Compare November 26, 2023 19:28
While we are in here, mark all dependencies as test_depend
(since this is a test-only package).

Signed-off-by: Chris Lalancette <[email protected]>
@clalancette clalancette force-pushed the clalancette/target-link-libraries branch from 2fa65c1 to c51f168 Compare November 26, 2023 21:45
@clalancette clalancette marked this pull request as draft November 27, 2023 13:29
@christophebedard
Copy link
Member

It looks like this breaks something in test_ros2trace, which relies on test_tracetools. I see the same failure in GitHub CI: https://github.com/ros2/ros2_tracing/actions/runs/6998187248/job/19035964490?pr=83#step:4:28701. I'll try to take a look today.

@clalancette
Copy link
Contributor Author

It looks like this breaks something in test_ros2trace, which relies on test_tracetools. I see the same failure in GitHub CI: https://github.com/ros2/ros2_tracing/actions/runs/6998187248/job/19035964490?pr=83#step:4:28701. I'll try to take a look today.

Yeah, agreed. That's why I changed it to a draft for now. Looking at the changes, I'm surprised; none of this really should make that difference. Thanks for taking a look!

@christophebedard
Copy link
Member

christophebedard commented Nov 27, 2023

mark all dependencies as test_depend (since this is a test-only package).

test_ros2trace uses node executables from test_tracetools, so test_ros2trace depended on test_tracetools <[exec_]depend>ing on std_msgs, rclcpp, and friends: https://github.com/ros2/ros2_tracing/actions/runs/6998187248/job/19035964490?pr=83#step:4:28395

Adding <test_depend>s for std_msgs (explicitly used by the test_tracetools nodes used in the test) and rclcpp (for other stuff like statistics_msgs) to test_ros2trace's package.xml fixes the issue, but I don't think test_ros2trace should have to think about this. I would suggest moving all dependencies related to the test_tracetools nodes back to <build_depend>/<exec_depend>.

I admit that it's a bit weird because the test_tracetools node executables are only built if -DBUILD_TESTING=ON. However, if we're not building/running test_tracetools tests, then we're probably not running test_ros2trace tests either, so it makes sense not to build the nodes.

Signed-off-by: Chris Lalancette <[email protected]>
@clalancette
Copy link
Contributor Author

test_ros2trace uses node executables from test_tracetools, so test_ros2trace depended on test_tracetools <[exec_]depend>ing on std_msgs, rclcpp, and friends: https://github.com/ros2/ros2_tracing/actions/runs/6998187248/job/19035964490?pr=83#step:4:28395

Thanks for this analysis, it was helpful.

While looking at this, it occurred to me that there was another solution here. And that is to export the dependencies that we need from test_tracetools so that colcon will properly setup the environment. That way we can keep all of the dependencies as test_depend, but just export the ones that are needed externally. I've done that in 819c592, and it seems to work in my testing.

Thoughts on this approach?

@christophebedard
Copy link
Member

christophebedard commented Nov 30, 2023

Sorry for the delay. That's a good idea.

However, if we want test_tracetools test node executables to be used by tests in other test_* packages, then we should do this for std_srvs and rclcpp_lifecycle too (I think those are the other required dependencies if a downstream package were to use all nodes). Explicitly mentioning test_ros2trace in test_tracetools and limiting the <build_export_depend> to just those dependencies feels a bit weird (i.e., test_tracetools ideally shouldn't know about downstream packages), but I don't really mind. We can always change it in the future; it's just a test package.

Signed-off-by: Chris Lalancette <[email protected]>
@clalancette
Copy link
Contributor Author

However, if we want test_tracetools test node executables to be used by tests in other test_* packages, then we should do this for std_srvs and rclcpp_lifecycle too (I think those are the other required dependencies if a downstream package were to use all nodes). Explicitly mentioning test_ros2trace in test_tracetools and limiting the <build_export_depend> to just those dependencies feels a bit weird (i.e., test_tracetools ideally shouldn't know about downstream packages), but I don't really mind. We can always change it in the future; it's just a test package.

Good points. I've updated it now to build_export_depend all of the necessary dependencies, and I've also updated the language to be less specific to test_ros2trace. I'm going to pull this out of draft status now and run CI on it, thanks for the review!

@clalancette clalancette marked this pull request as ready for review November 30, 2023 18:47
@clalancette
Copy link
Contributor Author

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

Copy link
Member

@christophebedard christophebedard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@clalancette clalancette merged commit 2081c06 into rolling Nov 30, 2023
9 checks passed
@clalancette clalancette deleted the clalancette/target-link-libraries branch November 30, 2023 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants